UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N0FQHW4ZzxKt6CtY/LkJvaDIDV+HzytIi+tPvszm54Y='
WHERE
key_id = 'e1186337b2009bf84854a300cb4a5b0742aa513a1d7b4ac80a65e513c03f8bf5'
AND (
token = 'N0FQHW4ZzxKt6CtY/LkJvaDIDV+HzytIi+tPvszm54Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)