UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b2kXGNKamk014779DE6HEYsN5GFvUThVUqOeQjyHZWc=' 
WHERE 
  key_id = '52eec8002c42e2b57c727d9419f6f4c1f931301bb87d8cea16183c5b5f193141' 
  AND (
    token = 'b2kXGNKamk014779DE6HEYsN5GFvUThVUqOeQjyHZWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035