UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PDK8fHcKHcvXOhmKHc0ikBksZuTsCEip1lVEBNxVAtY=' 
WHERE 
  key_id = 'e65604ef048d12ff9a333118506c37df02998af1cafb04d819203cafdd4f0611' 
  AND (
    token = 'PDK8fHcKHcvXOhmKHc0ikBksZuTsCEip1lVEBNxVAtY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034