UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x+zU2j8N//4qja6Xb58q2SULqppVAWXIVp6CcWU5aeg=' 
WHERE 
  key_id = '351747b620b9347f63a66f5862d3e33627bdcc93829e1eaa36236f01fe7c7db1' 
  AND (
    token = 'x+zU2j8N//4qja6Xb58q2SULqppVAWXIVp6CcWU5aeg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043