UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q6pBFb1pic7bCI90jzrANJJPWAuyE+2x5POLI+bfAew=' 
WHERE 
  key_id = '482b5401b2b93a8d778a00f07f42f8b65022ed734981b1b1d61ddaea30abdff1' 
  AND (
    token = 'Q6pBFb1pic7bCI90jzrANJJPWAuyE+2x5POLI+bfAew=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028