UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hHYlZNIcjcUNOK21HZw4eqonYqGKJoplXC1ukzDj1ag='
WHERE
key_id = '585c6d627f12967ff7c6ec7d4a8c405648ea7117d8e7fe463814295e205e7e80'
AND (
token = 'hHYlZNIcjcUNOK21HZw4eqonYqGKJoplXC1ukzDj1ag='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)