UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wXBvcazSMxOyLRXyiL11dEvnIib7hvumZVbLuKPpP3I=' 
WHERE 
  key_id = '26d01b85060afd960a8b09031ba1d0510f0812d234869038527c168dc05a4e06' 
  AND (
    token = 'wXBvcazSMxOyLRXyiL11dEvnIib7hvumZVbLuKPpP3I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046