UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OAPzy5kGPJm4O3Qa8Qmpjn2JmWJrBSTb6u77YTdjEDA='
WHERE
key_id = '1a6b0a5bca43df1ffa5e014643efee9593c8763be8ec0c093db5f97d372a2401'
AND (
token = 'OAPzy5kGPJm4O3Qa8Qmpjn2JmWJrBSTb6u77YTdjEDA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)