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