UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U7BCqZhOOg7kEPwzK29A9/Jb52+yf67a0FycMuLYN+k=' 
WHERE 
  key_id = 'c975e82103bf3997333d08083b2791d1ae4e770bc614b716cca6551636912b8b' 
  AND (
    token = 'U7BCqZhOOg7kEPwzK29A9/Jb52+yf67a0FycMuLYN+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029