UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lrhvMFGi5RCX6qzsvBc5aSaM4PTHg1ytQ2/Y+OVseec=' 
WHERE 
  key_id = '2c6961569fea774b13119513d72dc6fcefd0a7424b75b08bdf55e1390e1634f1' 
  AND (
    token = 'lrhvMFGi5RCX6qzsvBc5aSaM4PTHg1ytQ2/Y+OVseec=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027