UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JBSeHhy4RXS54kgqlqQ8cFBLFatnISHaplaQ5wtzPYg='
WHERE
key_id = '3ff5a40df15e5a50f963a9a83e92b7fed2cdf184e186666cc507670480d142b0'
AND (
token = 'JBSeHhy4RXS54kgqlqQ8cFBLFatnISHaplaQ5wtzPYg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)