UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ap3hx2BMmmlIBUgc45SGCigduQ7AknSf9o1sSeD44cU='
WHERE
key_id = '45c576a8a48e92aa8ab34f92605a2853fca4cc73f3e70e14319be717dcf313b5'
AND (
token = 'Ap3hx2BMmmlIBUgc45SGCigduQ7AknSf9o1sSeD44cU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)