UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e7/IhzivH2fm4LrJSxAMhF58c9BhVhPBgAgzKIr/6qk=' 
WHERE 
  key_id = '74b4c07e1a27081c72edf9ccc1f52ff88ae7ef083cfb8d89365994484eec9ba3' 
  AND (
    token = 'e7/IhzivH2fm4LrJSxAMhF58c9BhVhPBgAgzKIr/6qk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058