UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M7pxZJbQcqVvURU22VKk9LwfKPZ4CpDgntnZWu2gRL4='
WHERE
key_id = 'f3ebd9d29aeb3354e566fc1f65ea4ae6bd49e277f3615db3eddb80faeee5cf10'
AND (
token = 'M7pxZJbQcqVvURU22VKk9LwfKPZ4CpDgntnZWu2gRL4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)