UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lni/V59ypomGUW0NRMyVdvjJ8jkkTCOrpYYTfJYQP2I='
WHERE
key_id = 'e491c4ea52083ebb4f0f8913f37c8b17f680fd591bab239e4531fb0f88dee306'
AND (
token = 'lni/V59ypomGUW0NRMyVdvjJ8jkkTCOrpYYTfJYQP2I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)