UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'baddHfDBfGvUfOM6als/9/YBOwhqsIvP+JOsaXzW8Mk='
WHERE
key_id = '3a82be3fd708b37aa1db879e7091e4205347ccdb45e6edaddfff9c3476390ba3'
AND (
token = 'baddHfDBfGvUfOM6als/9/YBOwhqsIvP+JOsaXzW8Mk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)