UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X+jegidpXwYtxcq3XyrHegxlKLJx3LpGqLXqsx3oj84=' 
WHERE 
  key_id = '5143a7d653e2f027de0f0eafbf6627c17f29e85c148a35f7026a2f3502445e8e' 
  AND (
    token = 'X+jegidpXwYtxcq3XyrHegxlKLJx3LpGqLXqsx3oj84=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040