UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xb7jpnU9p3TwmoaRplMtf//E75FVcrzt3dSBPwuQQNI=' 
WHERE 
  key_id = '5d1342276f369ef9818d5201e26ed8782d1454104290fdf1c33e6269be9c2aa3' 
  AND (
    token = 'Xb7jpnU9p3TwmoaRplMtf//E75FVcrzt3dSBPwuQQNI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040