UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OFqjV2tDTa6OsJrXXUo0rKxnePM2MB4dTPTkzhtuqdw=' 
WHERE 
  key_id = '5cb20d71bb2510a6a75451368464b991e29c2da8a5d56e39bbefb3f96bff97b6' 
  AND (
    token = 'OFqjV2tDTa6OsJrXXUo0rKxnePM2MB4dTPTkzhtuqdw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040