UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D7Gl9/AsNtzvat+hoeR573pdN2wIy9mNn/GFRaU0Ij8=' 
WHERE 
  key_id = '7c83a29fe35704f1988571c4ee8a366e06d01f0075582028559165af551e87e9' 
  AND (
    token = 'D7Gl9/AsNtzvat+hoeR573pdN2wIy9mNn/GFRaU0Ij8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033