UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lc7O5RsqurivfCQUgYiGx9zZGkHlLFKnaXyiBPzAjHA=' 
WHERE 
  key_id = '6474d6babef73ed98043678f94f9e163cd6d4f3e5220584d40b84f2f42d12eb1' 
  AND (
    token = 'lc7O5RsqurivfCQUgYiGx9zZGkHlLFKnaXyiBPzAjHA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039