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