UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fqGo4WccF4x5BD2CWJqzjhBROrQLBsYL3hMZyOwRgj4='
WHERE
key_id = 'e436636a84e6e28ff1590410369f1ae9a0d670bb83befa9f0d515c60c86e8c8d'
AND (
token = 'fqGo4WccF4x5BD2CWJqzjhBROrQLBsYL3hMZyOwRgj4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)