UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8KxreMn6ubGulaLP2hctOp+7kke6+OTsUE1r3AMtDr8=' 
WHERE 
  key_id = '2c59cca58056e70906fcea329160ddc14bc9a0280bf30c781d0e7272bddb2582' 
  AND (
    token = '8KxreMn6ubGulaLP2hctOp+7kke6+OTsUE1r3AMtDr8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039