UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ijptl/T1f8+fAB63gDnRmSbV9tA2FruejeBA8j7FHkE=' 
WHERE 
  key_id = 'f24f32e70ef8d0dd5b98e09082cc63ccfaee6997853f7143851ab6e831ce217c' 
  AND (
    token = 'ijptl/T1f8+fAB63gDnRmSbV9tA2FruejeBA8j7FHkE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068