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