UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ti4lYX0eWn+zzxMvXu17oAkHffJkV4ozegyC/0omsYI='
WHERE
key_id = 'df6a183df91f69c490de3cf6429ea6cf1e61c522421577a4e70cc12f4b278b29'
AND (
token = 'ti4lYX0eWn+zzxMvXu17oAkHffJkV4ozegyC/0omsYI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)