UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'obIEXpM9BnbWT97xeER2yvJusv0ovb3L8xR7wBNtLrA=' 
WHERE 
  key_id = '48d9d6b97f30df7d46cdde76b0efaa93485b0e6cd6c42719a8af899461773428' 
  AND (
    token = 'obIEXpM9BnbWT97xeER2yvJusv0ovb3L8xR7wBNtLrA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032