UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rcX6JAuDnVoROiFv0OoDvkHVW+3s5KHOcDklO+BtA8k='
WHERE
key_id = 'f1f4ad9ef727c69925666af352f7b11008ec7d9377dc38dd9e1fd3bd1e5bc939'
AND (
token = 'rcX6JAuDnVoROiFv0OoDvkHVW+3s5KHOcDklO+BtA8k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)