UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rLiIbaLsMfefkH16LHO8Pbo0FUswAlMHczYcv4dwvYQ=' 
WHERE 
  key_id = '99550c9f4ffcffa4b65cd7a210b2a0ac5025f27693ffc87e63b2cdbdc0235e49' 
  AND (
    token = 'rLiIbaLsMfefkH16LHO8Pbo0FUswAlMHczYcv4dwvYQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030