UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PH9aC8IbQMAMW8kmgQxz15IJ+OfAqWVD0IoVOMbeUsg=' 
WHERE 
  key_id = 'ffe335f8a27f7a17b896d6f659a46a9b3e139abc1a2eb58626897a12743b714c' 
  AND (
    token = 'PH9aC8IbQMAMW8kmgQxz15IJ+OfAqWVD0IoVOMbeUsg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022