UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DE2WvTvUTRNcwxnTecaAB0Juj2edUx3FA6hkKCkymMU='
WHERE
key_id = '3803d435d84eba7d6b37508cf6dd95280bb6446fd64407051c3af38ab8dd072c'
AND (
token = 'DE2WvTvUTRNcwxnTecaAB0Juj2edUx3FA6hkKCkymMU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)