UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sq3BAyb+gfmuin7+6lfOKO0NO5kkG/h7HWC87Qh76gU=' 
WHERE 
  key_id = 'abd1cda32046d8c89500823ca128b05ce1f994ec5eeed72f8b3985528791740b' 
  AND (
    token = 'Sq3BAyb+gfmuin7+6lfOKO0NO5kkG/h7HWC87Qh76gU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00072