UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xa3sW+fFEDIVOEgm5dSw4S2bBAw6dX+77u/B4Ja7yzM=' 
WHERE 
  key_id = '1e7514c3b1bdb70b852c8d0626a404c2df4048bd355fe1ec2cdcc4f39ea18f99' 
  AND (
    token = 'Xa3sW+fFEDIVOEgm5dSw4S2bBAw6dX+77u/B4Ja7yzM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021