UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NQzxWUnz+h3hGucYwXOLFk8TWXZkjH4btlA4N4mjIr4='
WHERE
key_id = '92c201677545ff4bd336208a2a8d8d0483d145ad0c6460fccfa3bc3b117b37e8'
AND (
token = 'NQzxWUnz+h3hGucYwXOLFk8TWXZkjH4btlA4N4mjIr4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)