UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rtW9BHQVu4bfE0Hs0jrg9bJmbUrMTB1Nmg6sC4I6JvA=' 
WHERE 
  key_id = '60c85dba59eddd27fa6454518b2873a611fe23e16f4898b863d7562d56e87993' 
  AND (
    token = 'rtW9BHQVu4bfE0Hs0jrg9bJmbUrMTB1Nmg6sC4I6JvA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032