UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MP0+SGysL6FonLO2/w8qob4RugVGfrsCt4rOEMo3umE=' 
WHERE 
  key_id = 'a4c3de093a394e683dc64505e04aeff1bdd24308f05539e888fdeee5a82cec48' 
  AND (
    token = 'MP0+SGysL6FonLO2/w8qob4RugVGfrsCt4rOEMo3umE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029