UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0M77g2ZZB2IY70L3TsH7ygzCaRp5+TW1Lx259oqHpj0=' 
WHERE 
  key_id = 'f162cba5905cc3064115ca1ce15145b8895f6dba5fc55963d4d640953e738c68' 
  AND (
    token = '0M77g2ZZB2IY70L3TsH7ygzCaRp5+TW1Lx259oqHpj0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037