UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QcxHQ+4tDl6e+rEUZ+V6OBEIdx7DCui79bVlOrgTPAw=' 
WHERE 
  key_id = '9b7bcaae8efbe6deed530d4af08e72b5b0406f48b97926ed63f8c77b6a49341b' 
  AND (
    token = 'QcxHQ+4tDl6e+rEUZ+V6OBEIdx7DCui79bVlOrgTPAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034