UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '486yaVNeujPntUjsSg0axQuA5LH4caauHHV8NcTwCiA=' 
WHERE 
  key_id = 'ddb803677a74d3e7f5eb3b026c16c0f32ac29079b976072257feb89e84a7f2cf' 
  AND (
    token = '486yaVNeujPntUjsSg0axQuA5LH4caauHHV8NcTwCiA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026