UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xBE9spkNlKE5LdbWSrUylaiis2Eza5X0GBfrdFYqeL0='
WHERE
key_id = '2a1a871c4f0f977970d07caa76720736a4f3088bd2a74d17cb8d04169b7c194a'
AND (
token = 'xBE9spkNlKE5LdbWSrUylaiis2Eza5X0GBfrdFYqeL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)