UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rZU6/X+lmDcRmG94CmYtGAo5ZVRuOVhpxP0IMRuw+14=' 
WHERE 
  key_id = '6d531a862183f18c06afd11f10fc657235b475e6546d5cc4bb814d59851caccf' 
  AND (
    token = 'rZU6/X+lmDcRmG94CmYtGAo5ZVRuOVhpxP0IMRuw+14=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032