UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D+oQOhdLzDVSx+4qDTtLiSBkr/lhap9egx6PYFbZtXU=' 
WHERE 
  key_id = 'd74221aa5feb77c0d736d654bd6fa15d2ae01801eb454209f7aa15293a21e80a' 
  AND (
    token = 'D+oQOhdLzDVSx+4qDTtLiSBkr/lhap9egx6PYFbZtXU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026