UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Fp9+s/t4D5i4OXsJMKpEEb+onlJQ3d6dgMeHvjFlKFc=' 
WHERE 
  key_id = '400f8eef93532c2ffce33b8e73301ebbeed1c6a36dab648b037407e1ac7c80ba' 
  AND (
    token = 'Fp9+s/t4D5i4OXsJMKpEEb+onlJQ3d6dgMeHvjFlKFc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034