UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PWJ7FRNHgGKmybmC6JK/alZQyCKncMCd1f5DEqqVEaM='
WHERE
key_id = 'e1b3e3268039059446414b30841a7a376f948f9911efa14b6ced073efe65e4a0'
AND (
token = 'PWJ7FRNHgGKmybmC6JK/alZQyCKncMCd1f5DEqqVEaM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)