UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wl2iBjl7812fjR+xADem/m4ViATzFoRHpK9/i8TGxig=' 
WHERE 
  key_id = '8075f2c3d3f204472bf893ce5320b6f4815451f963a3e0a0995681700be5ab9d' 
  AND (
    token = 'Wl2iBjl7812fjR+xADem/m4ViATzFoRHpK9/i8TGxig=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026